package com.qf.data.api;

import com.qf.common.bean.R;
import com.qf.data.service.CheckCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 千锋健哥
 */
@RestController
@RequestMapping("/data/checkCode")
public class CheckCodeController {

    @Autowired
    private CheckCodeService checkCodeService;

    @PostMapping("/saveCode")
    public R saveRedis(@RequestParam String phone, @RequestParam String code) {
        R result = checkCodeService.saveCodeToRedis(phone, code);
        return result;
    }

    @GetMapping("/getCode/{phone}")
    public R getCode(@PathVariable(value = "phone") String phone) {
        R result = checkCodeService.getCode(phone);
        return result;
    }
}
